package com.ztman.service.work.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONPOJOBuilder;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ztman.basic.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.ztman.service.common.properties.MySqlJSONArrayHandler;
import com.ztman.service.common.properties.MySqlJsonHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

import org.apache.ibatis.type.JdbcType;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import static com.ztman.basic.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 *
 * </p>
 *
 * @author wsd
 * @since 2021-08-23
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "p_process_info", autoResultMap = true)
@ApiModel(value = "ProcessInfo", description = "")
@AllArgsConstructor
public class ProcessInfo extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "")
    @Length(max = 128, message = "长度不能超过128")
    @TableField(value = "name", condition = LIKE)
    @Excel(name = "")
    private String name;

    @ApiModelProperty(value = "流程")
    @Excel(name = "流程")
    @TableField(value = "structure", typeHandler = MySqlJsonHandler.class)
    private JSONObject structure;

    @ApiModelProperty(value = "")
    @TableField("classify_id")
    @Excel(name = "")
    private Long classifyId;

    @ApiModelProperty(value = "")
    @TableField(value = "tpls", typeHandler = MySqlJSONArrayHandler.class)
    @Excel(name = "")
    private JSONArray tpls;

    @ApiModelProperty(value = "")
    @TableField(value = "task", typeHandler = MySqlJSONArrayHandler.class)
    @Excel(name = "")
    private JSONArray task;

    @ApiModelProperty(value = "")
    @TableField("submit_count")
    @Excel(name = "")
    private Integer submitCount;

    @ApiModelProperty(value = "")
    @TableField(value = "notice", typeHandler = MySqlJSONArrayHandler.class)
    @Excel(name = "")
    private JSONArray notice;

    @ApiModelProperty(value = "")
    @Length(max = 128, message = "长度不能超过128")
    @TableField(value = "icon", condition = LIKE)
    @Excel(name = "")
    private String icon;

    @ApiModelProperty(value = "")
    @Length(max = 1024, message = "长度不能超过1024")
    @TableField(value = "remarks", condition = LIKE)
    @Excel(name = "")
    private String remarks;

    /**
     * 启用状态
     */
    @ApiModelProperty(value = "启用状态")
    @TableField("state")
    @Excel(name = "启用状态", replace = {"是_true", "否_false", "_null"})
    private Boolean state;

    /**
     * 删除状态
     */
    @ApiModelProperty(value = "删除状态")
    @TableField("del_flag")
    @Excel(name = "删除状态", replace = {"是_true", "否_false", "_null"})
    private Boolean delFlag;

    @Builder
    public ProcessInfo(Long id, LocalDateTime createTime, Long createdBy, LocalDateTime updateTime, Long updatedBy,
                       String name, JSONObject structure, Long classifyId, JSONArray tpls, JSONArray task,
                       Integer submitCount, JSONArray notice, String icon, String remarks,Boolean delFlag) {
        this.id = id;
        this.createTime = createTime;
        this.createdBy = createdBy;
        this.updateTime = updateTime;
        this.updatedBy = updatedBy;
        this.name = name;
        this.structure = structure;
        this.classifyId = classifyId;
        this.tpls = tpls;
        this.task = task;
        this.submitCount = submitCount;
        this.notice = notice;
        this.icon = icon;
        this.remarks = remarks;
        this.delFlag = delFlag;
    }

}
